<%@page language="java" contentType="text/html; character=UTF-8" pageEncoding="UTF-8" %>
<%@include file="/common/taglibs.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title>商家登录</title>
    <link type="text/css" rel="stylesheet" href="${ctx}/resources/ml/css/style.css">
    <link type="text/css" rel="stylesheet" href="${ctx}/resources/css/pintuer.css">
    <link type="text/css" rel="stylesheet" href="${ctx}/resources/css/admin.css">
    <script src="${ctx}/resources/js/jquery.js"></script>
    <script src="${ctx}/resources/js/pintuer.js"></script>
</head>
<body>
<div class="bg"></div>
<div class="container">s
    <div class="line bouncein">
        <div class="xs6 xm4 xs3-move xm4-move">
            <div style="height: 150px;"></div>
            <div class="media media-y margin-big-bottom"></div>
            <form name="LoginForm" >
                <div class="panel login-box">
                    <div class="text-center margin-big padding-big-top"><h1>商家登录</h1></div>
                    <div class="panel-body" style="padding: 30px;padding-bottom: 10px; padding-top: 10px;">
                        <div class="form-group">
                            <div class="field field-icon-right">
                                <input type="text" class="input input-big" name="sellerName" value="" placeholder="登录账号" data-validate="required:请填写账号" />
                                <span class="icon icon-user margin-small"></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="field field-icon-right">
                                <input type="password" class="input input-big" name="sellerPassword" value="" placeholder="登录密码" data-validate="required:请填写密码" />
                                <span class="icon icon-key margin-small"></span>
                            </div>
                        </div>
                    </div>
                    <div style="padding: 30px;">
                        <input type="button" class="button button-block bg-main text-big input-big" value="登录" onclick="LoginSub()" />
                    </div>
                    <div style="padding: 30px;">
                            <div class="field field-icon-right">
                                <a href="${ctx}/seller/register">没有账号？点我去注册</a>
                            </div>
                        </div>
                </div>
            </form>
        </div>
    </div>
</div>

<script type="text/javascript">
	function LoginSub() {
		var arr = new Array();
		var sn = LoginForm.sellerName.value;
		arr[0]=sn;
		var mm = LoginForm.sellerPassword.value;
		arr[1]=mm;
		$.post("${ctx}/login/toSLogin",{'sellerName':sn,'sellerPassword':mm},function(result){
			if(result.res == 1){
                alert("账号已被禁用，请联系管理员");
                window.location.href="${ctx}/login/uIndex";
            }else if(result.res == 0){
                alert("登录成功");
                window.location.href="${ctx}/login/sIndex";
            }else if (result.res == 2) {
            	alert("请稍后，待审核");
                window.location.href="${ctx}/login/uIndex";
			}else{
                alert("登录失败，请重试");
                window.location.reload();
            }	
		})

	}
</script>

</body>
</html>